# -*- coding:utf-8 -*-
# @FileName  :write_log.py
# @Time      :2023/11/15 23:56
# @Author    :lin

import logging

logging.basicConfig(level=logging.DEBUG,  # 控制台打印的日志级别
                    filename='log.log',
                    filemode='a',  # 模式，有w和a，w就是写模式，每次都会重新写日志，覆盖之前的日志
                    # a是追加模式，默认如果不写的话，就是追加模式
                    # format='%(asctime)s: %(message)s'
                    # format='%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s'
                    # 日志格式
                    )


# logging.debug('This is a debug message')
# logging.info('This is an info message')
# logging.warning('This is a warning message')
# logging.error('This is an error message')
# logging.critical('This is a critical message')


def print_log(*args):
    temp = ''
    for item in args:
        temp += str(item).encode('gbk', 'ignore').decode('gbk')
    print(temp)
    logging.info(temp)

# print_log(datetime.datetime.now().replace(microsecond=0))
